Previous Book Contents Book Index Next

Inside Macintosh: Programming With the Text Encoding Conversion Manager /
Chapter 3 - Text Encoding Converter Reference / Text Encoding Converter Functions
Investigating Encodings /


TECCreateSniffer

Creates a sniffer object and returns a reference to it.

pascal OSStatus TECCreateSniffer (
                     TECSnifferObjectRef *encodingSniffer, 
                     TextEncoding testEncodings[], 
                     ItemCount numTextEncodings);
encodingSniffer
A pointer to a sniffer object reference, which is of type TECSnifferObjectRef (page 65). On output, the reference pertains to the newly created sniffer object.
testEncodings[]
An array of text encoding specifications supplied by the caller; TECCreateSniffer will attempt to create a sniffer that is capable of sniffing for each of these encodings.
numTextEncodings
A value of type ItemCount that specifies the number of text encoding specifications in the testEncodings[] array.
function result
A result code. See "Text Encoding Conversion Manager Result Codes" (page 42) for a list of possible values. If other than noErr, then one of the text conversion plug-ins encountered an error when polled for available sniffers.
DISCUSSION
The TECCreateSniffer function polls plug-ins for available sniffers, creates a sniffer object capable of sniffing each of the specified encodings that it can find a sniffer function for, and returns a reference to it. You use this sniffer object reference with sniffer functions such as TECSniffTextEncoding (page 86). If no sniffer function is available for a particular encoding, no error is returned and TECSniffTextEncoding indicates later that the encoding was not examined.

To remove a sniffer object, you must call the function TECDisposeSniffer (page 89).

SEE ALSO
The function TECCountAvailableSniffers (page 83)

The function TECGetAvailableSniffers (page 84)


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 NOV 1997